<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Document</title>
		<script src="vue.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<input type="checkbox" id="checkbox" v-model="checked" @change="changeAllChecked()" />
			<label for="checkbx">
				{{checked}}
			</label>
			<br />
			<input type="checkbox" id="Runoob" value="1" v-model="checkedname" />
			<label for="Runoob">Runoob</label>
			<br />
			<input type="checkbox" id="Google" value="1" v-model="checkedname" />
			<label for="Google">Google</label>
			<br />
			<input type="checkbox" id="Taobao" value="1" v-model="checkedname" />
			<label for="Taobao">Taobao</label>
			<br />
			<span>选择的值为:{{checkedname}}</span>
		</div>
		
		<script type="text/javascript">
			var vm = new Vue({
				el: '#app',
				data: {
					checked: false,
					checkedname: [],
					checkedArr: ["1"]
				},
				methods: {
					changeAllChecked: function() {
						if (this.checked) {
							this.checkedname = this.checkedArr
						} else {
							this.checkedname = []
						}
					}
				}
			})
		</script>
		
	</body>
</html>
